<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="/css/personal.css" />
	<title>个人信息</title>
</head>
<body>
	<section class="infoList">
		<section>
			<p>
				<span>个人姓名：</span>
				<img src="/img/edituserNameLg.png" />
			</p>
			<input class="nameBox" placeholder="用户姓名" value="{{ $user_info['name'] }}" />
		</section>
		<section>
			<p>
				<span>身份证号：</span>
				<img src="/img/editIDLg.png" />
			</p>
			<input class="IDBox" placeholder="身份证号" value="{{ $user_info['id_number'] }}" />
		</section>
		<section>
			<p>
				<span>手机号码：</span>
				<img src="/img/editphoneLg.png" />
			</p>
			<input class="phoneBox" placeholder="手机号码" value="{{ $user_info['phone'] }}" />
		</section>
		<section>
			<p>
				<span>安装地址：</span>
				<img src="/img/editressLg.png" />
			</p>
			<input class="adressBox" placeholder="安装地址" value="{{ $user_info['installation_address'] }}" />
		</section>
		<section class="promptTxt" >温馨提示：为了及时有效为您提供售后服务，请准确填写个人资料</section>
	</section>
	
	<section class="fonterBtn">
		<a class="goBack" onclick="javascript:history.go(-1)">返回</a>
		<a class="okBtn">确定</a>
	</section>
	<!-- 提交信息服务器反馈提示信息-->
	<section class="hint_bg" style="display: none;">
		<section class="hint_box">
			<p class="hint_text" style="margin-top: 2.5rem;"></p>
			<section class="hint_btn" style="margin: 2rem auto;">确定</section>
		</section>
	</section>
	<script src="/js/jquery.min.js"></script>
	<script src="/js/public.js"></script>
	<script type="text/javascript">
		$(".okBtn").click(function(){
			var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;  
	  		if($(".nameBox").val()==""){
	  			hint("请输入姓名！");
	  		}else if(reg.test($(".IDBox").val()) === false){
	  			hint("身份证号码输入有误，请重新输入！");
			}else if(!(/^1[34578]\d{9}$/.test($(".phoneBox").val()))){
				hint("手机号码输入有误，请正确输入！");
			}else if($(".adressBox").val()==""){
				hint("请输入地址！");
			}else{
				$(".nameBox").siblings("img").hide();
				$(".IDBox").siblings("img").hide();
				$(".phoneBox").siblings("img").hide();
				$(".adressBox").siblings(".img").hide();
				$.ajax({
					url:"/api/user/info",
					type:"post",
					dataType:"json",
					data:{
						name:$(".nameBox").val(),
						id_number:$(".IDBox").val(),
						phone:$(".phoneBox").val(),
						installation_address:$(".adressBox").val()
					},
					success:function(data){
						if(data.status.errCode==0){
							hint("编辑成功！");
						}else{
							hint(data.status.message);
						}
					}
				});
			}
		});
	</script>
</body>
</html>
